package com.ebraga.trackerclub.android.dao.api;

import java.util.Date;

import com.ebraga.trackerclub.android.dao.entity.SyncDataAndroid;
import com.ebraga.trackerclub.android.exception.BackofficeDBConnectionException;
import com.ebraga.trackerclub.android.exception.dao.BackofficeDaoException;
import com.ebraga.trackerclub.android.exception.dao.BackofficeIllegalArgumentDaoException;

/**
 * Provides methods to manage information about Synchronization Data scheduler.
 */
public interface SyncDataDao {

	/**
	 * Returns the Sync data record for the given name.
	 * 
	 * @param name parameter name.
	 * @return the Sync data record
	 * @throws BackofficeIllegalArgumentDaoException if the given name is null.
	 * @throws BackofficeDaoException if occurs any other error.
	 * @throws BackofficeDBConnectionException if occurs a data base connection error.
	 */
	SyncDataAndroid getSyncData(String name) throws BackofficeDaoException, BackofficeDBConnectionException, BackofficeIllegalArgumentDaoException;
	
	/**
	 * Updates last try date time with the execution date time and returns it. 
	 * 
	 * @param name parameter name.
	 * @return the date time of last synchronization try.
	 * @throws BackofficeIllegalArgumentDaoException if the given name is not existent.
	 * @throws BackofficeDaoException if occurs any other error.
	 * @throws BackofficeDBConnectionException if occurs a data base connection error.
	 */
	Date updateLastTry(String name) throws BackofficeDaoException, BackofficeDBConnectionException, BackofficeIllegalArgumentDaoException;
	
	/**
	 * Updates last success date time with the execution date time and returns it.
	 * 
	 * @param name parameter name.
	 * @return the date time of last synchronization success.
	 * @throws BackofficeIllegalArgumentDaoException if the given name is not existent.
	 * @throws BackofficeDaoException if occurs any other error.
	 * @throws BackofficeDBConnectionException if occurs a data base connection error.
	 */
	Date updateLastSuccess(String name) throws BackofficeDaoException, BackofficeDBConnectionException, BackofficeIllegalArgumentDaoException;
}
